<#include "../common/basePage.ftl">
<@addCSS [
"/app/lib/css/plugins/clockpicker/clockpicker",
"/app/lib/css/plugins/select2/select2.min",
"/app/lib/css/plugins/datapicker/datepicker3",
"/app/lib/css/plugins/datapicker/bootstrap-datetimepicker",
"/app/lib/css/plugins/datapicker/bootstrap-datetimepicker.min",
"/app/lib/css/plugins/summernote/summernote-bs3",
"/app/lib/css/plugins/summernote/summernote",
"/app/lib/css/plugins/chosen/chosen",
"/app/lib/css/plugins/dataTables/datatables.min",
"/app/lib/css/plugins/footable/footable.core"
]/>

<@addJS [
"/app/lib/js/plugins/select2/select2.full.min",
"/app/lib/js/plugins/summernote/summernote.min",
"/app/lib/js/plugins/datapicker/bootstrap-datetimepicker",
"/app/lib/js/plugins/chosen/chosen.jquery",
"/app/lib/js/plugins/dataTables/datatables.min",
"/app/lib/js/plugins/footable/footable.all.min"

]/>

<@common "发起本周工作反馈">
<style>
.footable-row-detail-name{
	width:80px;
}
</style>
<input type="hidden" id="group" value="workprogress"/>
<input type="hidden" id="item" value="workingreport"/>
<div class="row">
    <div class="col-lg-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>本周工作反馈情况</h5>

                <div class="ibox-tools">
                    
                </div>
            </div>
            <div class="ibox-content">
            	

                <table class="table table-striped table-bordered table-hover dataTables-example" id="tb1" >
                    <thead>
                    <tr>
                        <th>中心</th>
                        <th>序号</th>
                        <th>任务内容</th>
                        <th>任务进展</th>
                        <th>责任人</th>
                        <th>工作计划</th>
                        <th>完成时限</th>
                        <th>任务状态</th>
                        <th>备注</th>
                    </tr>
                    <div class="custom_btn" style="float:left">
	            		<button type="button"  class="btn btn-primary  btn-warning" onclick="startweek()" style="margin:0px 10px">发起本周工作反馈</button>
                    </div>
                    </thead>
                    <tbody>
                       <#list datalist as data>
			            <tr class="gradeX">
			                <td >${(data.staffDepart)!}</td>
			                <td >${(data.jobId)!}</td>
			                 <td >${(data.jobName)!}</td>
			                <td >${(data.currentProgress)!}</td>
			                <td >${(data.staffNameAll)!}</td>
			                <td >${(data.futurePlan)!}</td>
			                <td >${(data.planDeadline)!}</td>
			                <td >${(data.jobStatus)!}</td>
			                <td >${(data.tips)!}</td>
			               
			            </tr>
		         </#list>
                    </tbody>
                    <tfoot>
                    	<tr>
                        <th>中心</th>
                        <th>序号</th>
                        <th>任务内容</th>
                        <th>任务进展</th>
                        <th>责任人</th>
                        <th>工作计划</th>
                        <th>完成时限</th>
                        <th>任务状态</th>
                        <th>备注</th>
                    </tr>
                    </tfoot>
                </table>				
                <div class="footer">
		        </div> 
            </div>
        </div>
    </div>
<script>
    $(document).ready(function(){
        
        $('#data_1 .input-group.date.form_datetime').datetimepicker({
            todayBtn: "linked",
            keyboardNavigation: false,
            forceParse: false,
            calendarWeeks: true,
            format: 'yyyy-mm-dd hh:ii:ss',
            minuteStep: 1,
            autoclose: true,
            endDate : new Date()  
        });
        
		$("#liableOrgan").trigger("chosen:updated");
		$("#liableOrgan").chosen({});
		
		$("#eventType").trigger("chosen:updated");
		$("#eventType").chosen({});
		
		$('.dataTables-example').DataTable({
            dom: '<"html5buttons"B>lTfgitp',
            pageLength:25,
            "ordering": false,
            buttons: [
                { extend: 'copy'},
                {extend: 'csv'},
                {extend: 'excel', title: 'ExampleFile'},
                {extend: 'pdf', title: 'ExampleFile'},

                {extend: 'print',
                 customize: function (win){
                        $(win.document.body).addClass('white-bg');
                        $(win.document.body).css('font-size', '10px');

                        $(win.document.body).find('table')
                                .addClass('compact')
                                .css('font-size', 'inherit');
                }
                }
            ]
        });
        
        $(".dataTables_length").hide();
        $(".dataTables_filter").hide();
        $(".dataTables_info").hide();
        
    });
    
        function startweek(){
    	$.ajax({
			url: webCfg.servePath + "/pc/workingreport/initialize",
			type : "POST",
			async:false,
			contentType : "application/x-www-form-urlencoded; charset=UTF-8"
		}).done(function(data) {
			    alert(data.msg);
			    window.location.reload();
		}).fail(function(jqXHR, error) {
				alert("åèµ·å¤±è´¥ï¼è¯·èç³»ç®¡çåï¼");
		});
    }
    
    
    function searchview(){
    	var eventType= $("#eventType_chosen .chosen-single").text();
    	eventType = eventType.substring(0,eventType.indexOf("("));
    	
    	var liableOrgan= $("#liableOrgan_chosen .chosen-single").text();
    	liableOrgan = liableOrgan.substring(0,liableOrgan.indexOf("("));
    	var data={
    		"title":$("#title").val(),
    		"eventType":eventType,
    		"startDateStr":$("#startDateStr").val(),
    		"endDateStr":$("#endDateStr").val(),
    		"flightNo":$("#flightNo").val(),
    		"flightLeg":$("#flightLeg").val(),
    		"liableOrgan":liableOrgan
    	};
    	
    	$.ajax(
			{
				url : webCfg.servePath + "/pc/eventreportinfo/listfilter",
				type : "POST",
				async:false,
				contentType : "application/x-www-form-urlencoded; charset=UTF-8",
				data : data
			}).done(
			function(data) {
				if ($('.dataTables-example').hasClass('dataTable')) {
                    dttable = $('.dataTables-example').dataTable();
                    dttable.fnClearTable(); //æ¸ç©ºä¸ä¸table
                    dttable.fnDestroy(); //è¿ååå§åäºçdatatable
                }
                $(".dataTables-example").find("tbody").html(data);
                $('.dataTables-example').DataTable({
            dom: '<"html5buttons"B>lTfgitp',
            pageLength:25,
            "ordering": false,
            buttons: [
                { extend: 'copy'},
                {extend: 'csv'},
                {extend: 'excel', title: 'ExampleFile'},
                {extend: 'pdf', title: 'ExampleFile'},

                {extend: 'print',
                 customize: function (win){
                        $(win.document.body).addClass('white-bg');
                        $(win.document.body).css('font-size', '10px');

                        $(win.document.body).find('table')
                                .addClass('compact')
                                .css('font-size', 'inherit');
                }
                }
            ]
        });
        
        $(".dataTables_length").hide();
        $(".dataTables_filter").hide();
        $(".dataTables_info").hide();
				
			}).fail(function(jqXHR, error) {
				alert("errorï¼");
		});
    }
    function status(tableid){

    	var tb = document.getElementById(tableid);
    	var endrow=tb.rows.length;
    	for(i=1; i<endrow-1; i++){
    	   if(tb.rows[i].cells[7].innerHTML==1){
    	      tb.rows[i].cells[7].innerHTML="中止";
    	   }else if(tb.rows[i].cells[7].innerHTML==0){
    	      tb.rows[i].cells[7].innerHTML="进行";
    	   }
    	   else if(tb.rows[i].cells[7].innerHTML==2){
     	      tb.rows[i].cells[7].innerHTML="结束";
     	   }
    	   else{
    	   tb.rows[i].cells[7].innerHTML="error!";
    	   }
    	}
    	}
    
    status('tb1');

</script>
</@common>
